<?php
include_once "objs/Visas.php";
include_once "models/VisaDao.php";
include_once "objs/News.php";
include_once "models/NewsDao.php";
include_once "models/MySqlDataAccessHelper.php";

MySqlDataAccessHelper::open();

$visas = VisaDao::getVisas();
$news = NewsDao::getNews();

MySqlDataAccessHelper::close();
?>
<div id="zt-modwrap">
    <div class="zt-modwrap-pad">
        <div id="zt-user5" class="zt-box-full" style="width: 100;">
            <div class="module-color zt-mod-br">
                <div class="zt-mod-bl">
                    <div class="zt-mod-tr">
                        <div class="zt-mod-tl clearfix">
                            <div class="mod-content" style="padding: 0px;">
                                <script type="text/javascript">
                                    var startJVTabs149 = function() {
                                        var jvTabDefault149 = new ZTTabDefault(
                                                {
                                                    container: 'jv_tabdefault149',
                                                    height: 0,
                                                    duration: 1000,
                                                    eventType: 'click',
                                                    isModule: 0,
                                                    effectType: 'scroll_tb'
                                                });
                                    };
                                    window
                                            .addEvent(
                                            'load',
                                            startJVTabs149);
                                </script>
                                <div style="display: none;">
                                    <a href="http://www.joomvision.com/"
                                       title="Joomla Templates">Joomla Templates</a> and
                                    Joomla Extensions by JoomVision.Com
                                </div>
                                <div class="jv_tab_default_wrap" style="width: 100%;">
                                    <div class="jv_default_container">
                                        <div class="jv_tabdefault wrap_top"
                                             id="jv_tabdefault149" style="margin-top: 0px;">
                                            <ul class="tabs_title top" >

                                                <li title="Chúc mừng đạt VISA"
                                                    class="bottom first active"><h3>
                                                        <span>Chúc mừng đạt VISA</span>
                                                    </h3></li>
                                                <li title="Tin tức" class="last"><h3>
                                                        <span>Tin tức</span>
                                                    </h3></li>

                                            </ul>
                                            <div class="jv_tabs_panel">
                                                <div class="jv_tabs_panel_r">
                                                    <div class="jv_tabs_panel_bc">
                                                        <div class="jv_tabs_panel_bl">
                                                            <div class="jv_tabs_panel_br">
                                                                <div class="panel_tc">
                                                                    <div class="panel_tl">
                                                                        <div class="panel_tr">
                                                                            <div class="jv_default_wrap1">
                                                                                <div style="height: 184px;"
                                                                                     class="jv_default_wrap2">


                                                                                    <div class="jv_default_content"
                                                                                         style="display: block; left: 0px; top: 0px;">
                                                                                        <div class="jv_default_conten_wrap">


                                                                                            <div class="custom">
                                                                                                <ul class="zt-gallery">
                                                                                                    <!-- begin chuc mung dat visa item-->
                                                                                                    <?php foreach($visas as $visa){ ?>
                                                                                                    <li><img alt=""
                                                                                                             src="<?php echo $visa->getImg(); ?>"
                                                                                                             style="width: 107px; height: 67px;"></li>
                                                                                                    <?php } ?>
                                                                                                    <!-- end chuc mung dat visa item-->

                                                                                                </ul>
                                                                                            </div>

                                                                                        </div>
                                                                                    </div>

                                                                                    <div class="jv_default_content"
                                                                                         style="display: block; left: 0px; top: 184px;">
                                                                                        <ul>
                                                                                            <!-- begin tin tuc item-->
                                                                                            <?php 
                                                                                            $countNew = 6;
                                                                                            if(count($news) < 6){
                                                                                                $countNew = count($news);
                                                                                            }
                                                                                            for($iNew = 0; $iNew < $countNew; $iNew++){ 
                                                                                                $new = $news[$iNew];
                                                                                                $index = mb_strpos($new->getContent(), '<p>', 50);
                                                                                                $shortNew = Util::getShortContent($new->getContent(), ' ', 200);//mb_substr($new->getContent(), $index + 3, 200);
                                                                                            ?>
                                                                                            <li class="jv_default_item">
                                                                                                <h3 class="news_title_wrap">
                                                                                                    <a
                                                                                                        title="<?php echo $new->getName(); ?>"
                                                                                                        href="tintuc.php?id=<?php echo $new->getId(); ?>">
                                                                                                        <?php echo $new->getName(); ?>
                                                                                                    </a>
                                                                                                </h3>
                                                                                                <div class="news_item">
                                                                                                    <div class="news_main_item">
                                                                                                        <a href="tintuc.php?id=<?php echo $new->getId(); ?>" title="<?php echo $new->getName(); ?>">
                                                                                                            <img align="left" style="width: 107px; height: 67px;" src="<?php echo $new->getThumbnail(); ?>" />
                                                                                                        </a>
                                                                                                        <?php echo $shortNew; ?>
                                                                                                    </div>

                                                                                                </div>

                                                                                            </li>
                                                                                            <?php } ?>
                                                                                            <!-- end tin tuc item-->

                                                                                            <!-- begin tintuc short item-->
                                                                                            <?php 
                                                                                            if(count($news) > 6){
                                                                                                for($iNew2=6; $iNew2 < count($news); $iNew2++){
                                                                                                    $new = $news[$iNew2];
                                                                                            ?>
                                                                                            <li class="jv_default_item">
                                                                                                <h3 class="news_title_wrap">
                                                                                                    <a
                                                                                                        title="<?php echo $new->getName(); ?>"
                                                                                                        href="tintuc.php?id=<?php echo $new->getId(); ?>">
                                                                                                    <?php echo $new->getName(); ?>
                                                                                                    </a>
                                                                                                </h3>

                                                                                            </li>
                                                                                            <?php  }
                                                                                            
                                                                                            } ?>
                                                                                            <!-- end tintuc short item-->

                                                                                            


                                                                                        </ul>
                                                                                    </div>

                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>


    </div>
</div>